#include "NewsWidget.h"

NewsWidget::NewsWidget():newsdisplay(), label(), np(CL_News_pool::get_news_pool_pointer())
{
    newsdisplay.set_wrap_mode(Gtk::WRAP_WORD);
    newsdisplay.set_editable(false);
    newsdisplay.set_justification(Gtk::JUSTIFY_CENTER);
    Gdk::Color color_black("black");
    Gdk::Color color_white("white");
    Glib::RefPtr< Gdk::Colormap > cm = newsdisplay.get_colormap();
    cm->alloc_color(color_black, false, true);
    cm->alloc_color(color_white, false, true);
    newsdisplay.modify_base(Gtk::STATE_NORMAL, color_black);
    newsdisplay.modify_text(Gtk::STATE_NORMAL, color_white);
    pack_start(label);
    pack_start(newsdisplay);
}

void NewsWidget::SetText(const std::string header, const std::string text)
{
    Glib::RefPtr< Gtk::TextBuffer > tb = newsdisplay.get_buffer ();
    tb->set_text(text);
    label.set_text(header);
}
